import {
  fetchOperationList,
} from '@/services/merchants'

const PlatformModel = {
  namespace: 'platform',
  state: {
    inform: {},
  },
  effects: {
    *fetchOperateList({ payload }, { call, put }) {
      const res =  yield call(getOperateByPermission, payload);

      if (res.code == 0) {
        const response = yield call(fetchOperationList);
        yield put({
          type: 'changeModelState',
          payload: {
            radioGroup: response.data,
            selected: res.data && res.data[0].id,
          },
        });
      }
    },
  },
  reducers: {
    update(state, action) {
      return {
        ...state,
        ...action.payload
      }
    }
  },
};
export default PlatformModel;